package com.czh.subject.infra.basic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.czh.subject.infra.basic.mapper.SubjectLikedMapper;
import com.czh.subject.infra.basic.entity.SubjectLiked;
import com.czh.subject.infra.basic.service.SubjectLikedService;
import org.springframework.stereotype.Service;

import java.util.List;
import lombok.RequiredArgsConstructor;

/**
 * 题目点赞表(SubjectLiked)表服务实现类
 *
 * @author caozaihui
 * @since 2024-09-14 11:39:45
 */
@Service("subjectLikedService")
@RequiredArgsConstructor
public class SubjectLikedServiceImpl extends ServiceImpl<SubjectLikedMapper, SubjectLiked> implements SubjectLikedService {
       
 
        /** 
         * 
         * @param  id 主键
         * @author caozaihui  
         * @description //TODO  通过ID查询单条数据
         * @date 2024-09-14 11:39:45
         * @return 实例对象
         */
        @Override
        public SubjectLiked selectSubjectLikedById (Long id) {
                return baseMapper.selectById(id);
        }
        
        /** 
         * 
         * @param subjectLiked 实例对象
         * @author caozaihui  
         * @description //TODO  分页查询数据
         * @date 2024-09-14 11:39:45
         * @return 实例对象
         */
        @Override
        public List<SubjectLiked> querySubjectLikedList (SubjectLiked subjectLiked) {
            return baseMapper.selectSubjectLikedList(subjectLiked);     
        }

        @Override
        public int querySubjectLikedCount(SubjectLiked subjectLiked) {
                return baseMapper.count(subjectLiked);
        }


        @Override
        public SubjectLiked querySubjectLiked(SubjectLiked subjectLiked) {
                return baseMapper.selectSubjectLiked(subjectLiked);
        }

        @Override
        public Boolean batchInsert(List<SubjectLiked> subjectLikedList) {
                return baseMapper.batchInsertOrUpdate(subjectLikedList)>0;
        }

        /** 
         * 
         * @param subjectLiked 实例对象
         * @author caozaihui  
         * @description //TODO  新增数据
         * @date 2024-09-14 11:39:45
         * @return 实例对象
         */
        @Override
        public int insert(SubjectLiked subjectLiked) {
               return baseMapper.insert(subjectLiked);
        }
        
        
        /** 
         * 
         * @param subjectLiked 实例对象
         * @author caozaihui  
         * @description //TODO  修改数据并返回
         * @date 2024-09-14 11:39:45
         * @return 实例对象
         */
        @Override
        public int update(SubjectLiked subjectLiked) {
                return  baseMapper.updateById(subjectLiked);
        }
        
        
        /**
         *
         * @param idList 主键
         * @author caozaihui 
         * @description //TODO    通过主键删除数据
         * @date 2024-09-14 11:39:45
         * @return
         */
        @Override
        public int deleteByIds(List<Long> idList) {
            return baseMapper.deleteByIds(idList);
        }

        @Override
        public List<SubjectLiked> querySubjectLikedPage(SubjectLiked subjectLiked, int start, Integer pageSize) {
                return baseMapper.selectSubjectLikedPage(subjectLiked,start,pageSize);
        }
}

